<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ include file="/base.jsp"%>
<!doctype html>
<html lang="en">
 <head>
  <meta charset="UTF-8">
  <meta name="Generator" content="EditPlus®">
  <meta name="Author" content="">
  <meta name="Keywords" content="">
  <meta name="Description" content="">
  <title>我是内嵌的页面</title>
   <link href="${ctx}/ueditor/bootstrap/css/bootstrap.css" rel="stylesheet" type="text/css" />
    <link href="${ctx}/ueditor/css/site.css" rel="stylesheet" type="text/css" />
    <link href="${ctx}/ueditor/css/common.css" type="text/css" rel="stylesheet" /> <!--通用样式-->
    <script type="text/javascript" charset="utf-8" src="${ctx}/ueditor/js/jquery-1.11.2.min.js"></script> 
    <script type="text/javascript" charset="utf-8" src="${ctx}/ueditor/layer/layer.js"></script> 
  <style>
  
  #contract_person .contract_person_search .person_input_search{border:1px solid #ddd;width:200px;height:30px;
margin:10px  10px;border-radius:4px;padding:0 23px 0 3px ;
background:url("${ctx}/ueditor/images/search.png") no-repeat    right;}
 
  /*合同状态*/
#contract_person .contract_dept_type{width:100%;}
#contract_person .contract_dept_type .cont_state_title{padding-left:15px;}
#contract_person .contract_dept_type ul{width:98%;margin:0 auto;overflow:auto;margin-top:5px;}
#contract_person .contract_dept_type ul .cont_state_name{float:left;padding-top:4px;}
#contract_person .contract_dept_type ul li{float:left;margin:2px 2px;font-size:15px;line-height:22px;
 padding:2px 10px;border-radius:6px;}
#contract_person .contract_dept_type ul li:hover{cursor:pointer;}
.on{background:#EA0605;color:#fafafa;}


/*选人列表 */
#contract_person_list{ width:100%;}
#contract_person_list h1{font-size:13px;margin:5px 10px;}
#contract_person_list ul.person_list_parent{width:98%;height:350px;margin:0 auto;border:1px solid #ddd;overflow:auto;}
#contract_person_list ul.person_list_parent li.person_list_parent_box{float:left;width:49%;border-right:1px solid #ddd;}

#contract_person_list ul.person_list_parent li ul.list_child{border-bottom:1px solid #ddd;overflow:auto;line-height:35px;}
#contract_person_list ul.person_list_parent li ul.list_child li{float:left;width:33%;text-align:center;}
.footer{margin:20px 20px;overflow:auto;}
.footer .footer_right{width:200px;float:right;}
.footer .footer_right  a{border:1px solid #ddd;display:block;width:85px;line-height:30px;float:left;text-align:center;
text-decoration:none;border-radius:4px;}
.footer .footer_right  a:hover{cursor:pointer;}
.footer .footer_right  a:first-child{margin-right:20px;color:#565656;}
.footer .footer_right  a:last-child{color:#fafafa;background:#EA0605;}  
  </style>
 </head>
 <body>
   <div id="contract_person" style="">
  <div class="contract_person_search"><input type="text" class="person_input_search" /></div>
  <div class="contract_dept_type">
         <ul id="dept_list">
			  <span class="cont_state_name">分类：</span>
			    <li class="on">全部</li>	
			 </ul>
  </div>
  
  <div id="contract_person_list">
     <h1>申购人列表</h1>
     <ul class="person_list_parent">
       <li class="person_list_parent_box">
         <ul class="list_child">
           <li><input type="radio" name="name" value="" title="单选"/></li>
           <li>姓名</li>
           <li>是否在职</li>
         </ul>
       </li>
       
        <li class="person_list_parent_box">
         <ul class="list_child">
           <li><input type="radio" name="name" value="" title="单选"/></li>
           <li>姓名</li>
           <li>是否在职</li>
         </ul>    
       </li>    
     </ul>
  </div>
  <div class="footer"> 
    <div class="footer_right"><a id="cancel">取消</a><a id="deter">确定</a></div>
  </div>
</div>  
<script>
 var dept;
 var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
 var dept=[{"id":"1","name":"张三","dept":"一部","sex":"男","age":"18","job":"true"},{"id":"2","name":"李四","dept":"二部","sex":"男","age":"22","job":"true"},{"id":"3","name":"赵XX","dept":"三部","sex":"女","age":"23","job":"true"}];
	
$(function(){
	//初始化数据 
	get_person_user_list();
  //取消 
  $('#cancel').on('click', function(){
	  parent.layer.close(index);
	});
  //确定 
  $('#deter').on('click', function(){
	  data_list();
	});
  
  //选部门 
  $("#dept_list").find("li").click(function(){
	  //$(this).addClass("on");
	  //$(this).toggleClass("on");
	  $(this).toggleClass("on").siblings().removeClass("on");
  });
  
});


function get_person_user_list(){
	var dept_html="";
	var user_html="";
	//初始化方法 
	//alert("初始化");
	//var job_true=res.userRealName==null? "":res.userRealName;
	for(var i=0;i<dept.length;i++){
	  console.log(dept[i].dept); 
	  job_true=dept[i].job==true? "否":"是";
	  dept_html+='<li>'+ dept[i].dept +'</li>';
	  user_html+='<ul class="list_child">';
	  user_html+='<li><input type="radio" name="name" value='+dept[i].id+' title="单选"/></li>';
	  user_html+='<li>'+dept[i].name+'</li>';
	  user_html+='<li>'+job_true+'</li>';
	  user_html+='</ul>';
   }
	   console.log(user_html);
	  $("#dept_list").append(dept_html);
	  $(".person_list_parent_box").append(user_html);
}


    //确定选人 
 function  data_list(){
	// var val_payPlatform = $('#wrap input[name="payMethod"]:checked ').val();
       var check_id = $('#contract_person_list input[name="name"]:checked ').val();
    	//alert(check_id);
    	var name;
    	var person_dept;
       //parent.layer.close(index);
       for(var i=0;i<dept.length;i++){
    	   if(check_id==dept[i].id ){ 
        	  name=  dept[i].name;
        	  person_dept=dept[i].dept;
           }
    	   //alert(name+"==="+person_dept);
    	   console.log(name+"===="+person_dept);
    	   parent.set_val(name,person_dept);
       }
       parent.layer.close(index); //关闭弹出框  
	 };

 
 /*
 	$.ajax({
    		url : "${pageContext.request.contextPath}/news/topic/delete.action",
			data : {
				"id" : id
			},
			success : function(res) {
				layer.close(index);
				if (res.state == "success") {
					layer.msg(res.errors[0]);
					var data = $("#topic-list-form").serializeObject();
					data.state = 1;
					datagrid.getData(data);
				} else {
					layer.msg(res.errors.join(","));
				}
			},
			error : function() {
				layer.close(index);
				layer.alert("网络异常,请稍后再试");
			}
    	});
 
 
 */ 
 
 
 
 
</script>
 
 </body>
</html>